//
//  ViewController.m
//  intelligent
//
//  Created by 甘世清 on 2024/2/5.
//

#import "ViewController.h"
#import "MeViewController.h"
#import "HomeViewController.h"
#import "JobViewController.h"
#import "AssistantViewController.h"
#import "JobDetailsViewController.h"
#import "ChartingViewController.h"
#import "MeVipViewController.h"
@interface ViewController ()
@property (nonatomic , strong)HomeViewController * homeVC;
@property (nonatomic , strong)JobViewController * jobVC;
@property (nonatomic , strong)ChartingViewController * chartVC;
@property (nonatomic , strong)AssistantViewController * assistantVC;
@property (nonatomic , strong)MeViewController * meVC;


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = UIColor.SQ_randomColor;
    [self SQ_UIViewForSElfView];
}
-(void)SQ_UIViewForSElfView{
    self.tabBar.backgroundColor = UIColor.whiteColor;
    self.tabBar.itemTitleSelectedColor = UIColor.blackColor;
    self.tabBar.itemTitleColor = SQColor666666;
    self.tabBar.itemTitleFont = FONT_MEDIUM(10);
    [self setTabBarFrame:CGRectMake(0, SCREEN_HEIGHT-FootHeight-40, SCREEN_WIDETH, 40+FootHeight)
        contentViewFrame:CGRectMake(0, 0, SCREEN_WIDETH, SCREEN_HEIGHT-40)];
//    self.tabContentView.defaultSelectedTabIndex = 1;
    self.viewControllers = [NSMutableArray arrayWithObjects: self.homeVC,self.jobVC,self.chartVC,self.assistantVC,self.meVC,nil];
    [self.tabBar setItemContentHorizontalCenterAndMarginTop:4 spacing:2];
    if (![UserModel share].isVip) {
        MeVipViewController* vc= [[MeVipViewController alloc]init];
        [self.navigationController pushViewController:vc animated:NO];
    }
}
- (HomeViewController *)homeVC{
    if (!_homeVC) {
        _homeVC = [[HomeViewController alloc]init];
        _homeVC.yp_tabItemImage = SQGetImage(@"首页-灰");
        _homeVC.yp_tabItemSelectedImage = SQGetImage(@"首页-亮");
        _homeVC.yp_tabItemTitle = SQNSLocalString(@"首页");
    }
    return _homeVC;
}
- (JobViewController *)jobVC{
    if (!_jobVC) {
        _jobVC = [[JobViewController alloc]init];
        _jobVC.yp_tabItemImage = SQGetImage(@"工作页-灰");
        _jobVC.yp_tabItemSelectedImage = SQGetImage(@"工作页-亮");
        _jobVC.yp_tabItemTitle = SQNSLocalString(@"创作");
    }
    return _jobVC;
}
- (ChartingViewController *)chartVC{
    if (!_chartVC) {
        _chartVC = [[ChartingViewController alloc]init];
        _chartVC.yp_tabItemImage = SQGetImage(@"绘画-灰");
        _chartVC.yp_tabItemSelectedImage = SQGetImage(@"绘画-亮");
        _chartVC.yp_tabItemTitle = SQNSLocalString(@"制图");
    }
    return _chartVC;
}
- (AssistantViewController *)assistantVC{
    if (!_assistantVC) {
        _assistantVC = [[AssistantViewController alloc]init];
        _assistantVC.yp_tabItemImage = SQGetImage(@"助理页-灰");
        _assistantVC.yp_tabItemSelectedImage = SQGetImage(@"助理页-亮");
        _assistantVC.yp_tabItemTitle = SQNSLocalString(@"助理");
    }
    return _assistantVC;
}
- (MeViewController *)meVC{
    if (!_meVC) {
        _meVC = [[MeViewController alloc]init];
        _meVC.yp_tabItemImage = SQGetImage(@"个人中心-灰");
        _meVC.yp_tabItemSelectedImage = SQGetImage(@"个人中心-亮");
        _meVC.yp_tabItemTitle = SQNSLocalString(@"个人");
    }
    return _meVC;
}
@end
